<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>首页</title>
    <link rel="stylesheet" type="text/css" href="/static/layui/css/layui.css">
    <link rel="stylesheet" type="text/css" href="/static/bootstrap/bootstrap-3.4.1-dist/css/bootstrap.min.css">
</head>
<body>
<script type="text/javascript" src="/static/bootstrap/bootstrap-3.4.1-dist/js/jquery-3.4.1.min.js"></script>
<script type="text/javascript" src="/static/bootstrap/bootstrap-3.4.1-dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script type="text/javascript" src="/static/vue.js"></script>
<script>
    //JS
    $(function () {
        $("#layuiBody").load("schoolIntroduction");
        $(".twoMenu").each(function () {
            $(this).click(function () {
                var url = $(this).attr("href");
                $("#layuiBody").load('/html/' + url);
                return false;
            })
        })
    })
    layui.use(['element', 'layer', 'util'], function () {
        var element = layui.element
            , layer = layui.layer
            , util = layui.util
            , $ = layui.$;

        //头部事件
        util.event('lay-header-event', {
            //左侧菜单事件
            menuLeft: function (othis) {
                layer.msg('展开左侧菜单的操作', {icon: 0});
            }
            , menuRight: function () {
                layer.open({
                    type: 1
                    , content: '<div style="padding: 15px;">处理右侧面板的操作</div>'
                    , area: ['260px', '100%']
                    , offset: 'rt' //右上角
                    , anim: 5
                    , shadeClose: true
                });
            }
        });

    });
</script>
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs layui-bg-black">无验校务管理系统</div>
        <!-- 头部区域（可配合layui 已有的水平导航） -->
        <ul class="layui-nav layui-layout-left">
            <!-- 移动端显示 -->
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-spread-left"></i>
            </li>

            <li class="layui-nav-item layui-hide-xs"><a href="">nav 1</a></li>
            <li class="layui-nav-item layui-hide-xs"><a href="">nav 2</a></li>
            <li class="layui-nav-item layui-hide-xs"><a href="">nav 3</a></li>
            <li class="layui-nav-item">
                <a href="javascript:;">nav groups</a>
                <dl class="layui-nav-child">
                    <dd><a href="">menu 11</a></dd>
                    <dd><a href="">menu 22</a></dd>
                    <dd><a href="">menu 33</a></dd>
                </dl>
            </li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item layui-hide layui-show-md-inline-block">
                <a href="javascript:;">
                    <img src="//tva1.sinaimg.cn/crop.0.0.118.118.180/5db11ff4gw1e77d3nqrv8j203b03cweg.jpg" id="userPic"
                         class="layui-nav-img">
                    <span id="userName"></span>
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="">Your Profile</a></dd>
                    <dd><a href="">Settings</a></dd>
                    <dd><a id="logout" href="">Sign out</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item" lay-header-event="menuRight" lay-unselect>
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-more-vertical"></i>
                </a>
            </li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">首页</a>
                    <dl class="layui-nav-child">
                        <dd><a href="schoolIntroduction" class="twoMenu">校园简介</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">校园设施</a>
                    <dl class="layui-nav-child">
                        <dd><a href="Classroom" class="twoMenu">教室管理</a></dd>
                        <dd><a href="Device" class="twoMenu">设备管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">教务管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="bookManager" class="twoMenu">教材管理</a></dd>
                        <dd><a href="javascript:;" class="twoMenu">班级管理</a></dd>
                        <dd><a href="examManager" class="twoMenu">考试管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">人员管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="studentManager" class="twoMenu">学生管理</a></dd>
                        <dd><a href="parentManager" class="twoMenu">家长管理</a></dd>
                        <dd><a href="teacherManager" class="twoMenu">教师管理</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">基础设置</a>
                    <dl class="layui-nav-child">
                        <dd><a href="course" class="twoMenu">科目设置</a></dd>
                        <dd><a href="grade" class="twoMenu">年级设置</a></dd>
                        <dd><a href="clazz" class="twoMenu">班级设置</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">系统管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="userManager" class="twoMenu">用户管理</a></dd>
                        <dd><a href="roleManager;" class="twoMenu">角色管理</a></dd>
                        <dd><a href="permissionManager" class="twoMenu">权限管理</a></dd>
                    </dl>
                </li>
            </ul>
        </div>
    </div>

    <div class="layui-body" id="layuiBody">
        <!-- 内容主体区域 -->
        <div style="padding: 15px;" id="">内容主体区域。记得修改 layui.css 和 js 的路径</div>
    </div>
</div>
<script type="text/javascript">
    $(function () {
        var userName = localStorage.getItem("userName");
        var userPic = localStorage.getItem("userPic");
        $("#userName").html(userName);
        $("#userPic").attr('src', userPic)

        $("#logout").click(function () {
            if (!confirm("确认退出?"))
                return false;
            $.ajax({
                url: '/user/loginOut',
                type: 'get',
                dataType: 'json',
                success: function (data) {
                    if (data.code == 0) {
                        alert("退出成功")
                        location.href = "/html/login";
                    } else {
                        alert(data.msg)
                    }
                }
            })
            return false;
        })
    })
</script>
</body>
</html>